1 module hip.api.audio; 2 3 //Low weight shared data 4 enum HipAudioType 5 { 6 SFX, 7 MUSIC 8 } 9 10 /** 11 * Controls how the gain will falloff 12 */ 13 enum DistanceModel 14 { 15 DISTANCE_MODEL, 16 /** 17 * Very similar to the exponential curve 18 */ 19 INVERSE, 20 INVERSE_CLAMPED, 21 /** 22 * Linear curve, the only which can achieve 0 volume 23 */ 24 LINEAR, 25 LINEAR_CLAMPED, 26 27 /** 28 * Exponential curve for the model 29 */ 30 EXPONENT, 31 /** 32 * When the distance is below the reference, it will clamp the volume to 1 33 * When the distance is higher than max distance, it will not decrease volume any longer 34 */ 35 EXPONENT_CLAMPED 36 } 37 38 enum HipAudioImplementation 39 { 40 Null, 41 OpenAL, 42 OpenSLES, 43 XAudio2, 44 WebAudio, 45 AVAudioEngine 46 } 47 48 HipAudioImplementation getAudioImplementationForOS() 49 { 50 with(HipAudioImplementation) 51 { 52 version(NullAudio) return Null; 53 else version(Android) return OpenSLES; 54 else version(Windows) return XAudio2; 55 else version(WebAssembly) return WebAudio; 56 else version(iOS) return AVAudioEngine; 57 else return OpenAL; 58 } 59 } 60 61 version(DirectCall) { public import hip.hipaudio; } 62 else version(ScriptAPI) 63 { 64 public import HipAudio = hip.api.audio.audio_binding; 65 public import hip.api.audio.audioclip:IHipAudioClip; 66 public import hip.api.audio.audiosource:AHipAudioSource; 67 }